
package org.soekrat.engine.ontology.ptable;

import java.io.CharArrayWriter;
import java.io.PrintWriter;
import java.util.List;

import org.soekrat.engine.SoekratName;

public final class FactorPair 
{
  private final SoekratName m_row;
  
  private final SoekratName m_col;
  
  FactorPair(SoekratName row, SoekratName col)
  {
    if (row==null)
    {
      throw new NullPointerException("row");
    }
    if (col==null)
    {
      throw new NullPointerException("col");
    }
    
    m_row=row;
    m_col=col;
  }
  
  @Override
  public String toString() 
  {
    StringBuilder sb=new StringBuilder();
    
    sb.append(m_row).append(" - ").append(m_col);
    
    return sb.toString();
  }
  
  public static String toString(List<FactorPair> l)
  {
    if (l==null)
    {
      throw new NullPointerException("l");
    }
    
    CharArrayWriter caw=new CharArrayWriter();
    PrintWriter pw=new PrintWriter(caw);
    
    for (FactorPair curr : l) pw.println(curr);
    
    pw.flush();
    return caw.toString();
  }
  
}
